{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 118,
   "id": "fc48498d",
   "metadata": {},
   "outputs": [],
   "source": [
    "class Animal():\n",
    "    def capacidades(self):\n",
    "        texto = \"\"\n",
    "        for k in self.__dict__.keys():\n",
    "            texto += f\" {'Si' if self.__dict__[k] else 'No'} {k} \\n\"\n",
    "        print(texto)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 119,
   "id": "dc04de5b",
   "metadata": {},
   "outputs": [],
   "source": [
    "class Ave(Animal):\n",
    "    def __init__(self):\n",
    "        super().__init__()\n",
    "        self.vuela = True\n",
    "        self.camina = False\n",
    "        self.nada = False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 120,
   "id": "dd41a6d6",
   "metadata": {},
   "outputs": [],
   "source": [
    "class AnimalCorral(Animal):\n",
    "    def __init__(self):\n",
    "        super().__init__()\n",
    "        self.carne = True\n",
    "        self.huevos = True\n",
    "        self.leche = True\n",
    "        self.montura = False\n",
    "        \n",
    "    def granjear(self):\n",
    "        print(\"granjeando ...\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 121,
   "id": "299daeb5",
   "metadata": {},
   "outputs": [],
   "source": [
    "class Pingüino(Ave):\n",
    "    def __init__(self):\n",
    "        super().__init__()\n",
    "        self.vuela = False\n",
    "        self.camina = True\n",
    "        self.nada = True\n",
    "        \n",
    "class Avestruz(Ave, AnimalCorral):\n",
    "    def __init__(self):\n",
    "        AnimalCorral.__init__(self)\n",
    "        Ave.__init__(self)\n",
    "        self.vuela = False\n",
    "        self.corre = True\n",
    "        self.leche = False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 122,
   "id": "6d736675",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Capacidades de ave:\n",
      " Si vuela \n",
      " No corre \n",
      " No nada \n",
      "\n",
      "Capacidades de pingu:\n",
      " No vuela \n",
      " No corre \n",
      " Si nada \n",
      " Si camina \n",
      "\n",
      "capacidades de avestruz:\n",
      " Si carne \n",
      " Si huevos \n",
      " No leche \n",
      " No montura \n",
      " No vuela \n",
      " Si corre \n",
      " No nada \n",
      "\n",
      "granjeando ...\n"
     ]
    }
   ],
   "source": [
    "ave = Ave()\n",
    "pingu = Pingüino()\n",
    "avestruz = Avestruz()\n",
    "print(\"Capacidades de ave:\")\n",
    "ave.capacidades()\n",
    "print(\"Capacidades de pingu:\")\n",
    "pingu.capacidades()\n",
    "print(\"capacidades de avestruz:\")\n",
    "avestruz.capacidades()\n",
    "avestruz.granjear()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "313d373b",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
